import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class JrScaffold extends StatelessWidget {
  final Widget body;
  final PreferredSizeWidget appBar;
  final bool defaultTopPadding;
  const JrScaffold({Key? key, required this.body, required this.appBar, this.defaultTopPadding = true})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: appBar,
      extendBody: true,
      extendBodyBehindAppBar: true,
      body: Stack(
        children: [
          Container(
            decoration: const BoxDecoration(
              // Create a diagonal gradient from the left top to the right bottom
              gradient: LinearGradient(
                begin: Alignment.bottomLeft,
                end: Alignment.topRight,
                colors: [
                  Color(0xFF2B1628), // Left bottom corner color
                  Color(0xFF7B4BAA), // Right top corner color
                ],
              ),
            ),
          ),
          Container(
            padding: defaultTopPadding ? EdgeInsets.only(top: appBar.preferredSize.height.h + 54.h) : null,
            child: body,
          )
        ],
      ),
    );
  }
}
